import containerWarnSvg from './images/container-warning.svg';
import containerErrorSvg from './images/container-error.svg';
import containerGraySvg from './images/container-gray.svg';
import containerSvg from './images/container.svg';
import podWarnSvg from './images/pod-warning.svg';
import podErrorSvg from './images/pod-error.svg';
import podGraySvg from './images/pod-gray.svg';
import podSvg from './images/pod.svg';
import hostIpWarnSvg from './images/hostIp-warning.svg';
import hostIpErrorSvg from './images/hostIp-error.svg';
import hostIpGraySvg from './images/hostIp-gray.svg';
import hostIpSvg from './images/hostIp.svg';
import workloadWarnSvg from './images/workload-warning.svg';
import workloadErrorSvg from './images/workload-error.svg';
import workloadGraySvg from './images/workload-gray.svg';
import workloadSvg from './images/workload.svg';
import serviceWarnSvg from './images/service-warning.svg';
import serviceErrorSvg from './images/service-error.svg';
import serviceGraySvg from './images/service-gray.svg';
import serviceSvg from './images/service.svg';
import namespaceWarnSvg from './images/namespace-warning.svg';
import namespaceErrorSvg from './images/namespace-error.svg';
import namespaceGraySvg from './images/namespace-gray.svg';
import namespaceSvg from './images/namespace.svg';
import vmprocessWarnSvg from './images/vmprocess-warning.svg';
import vmprocessErrorSvg from './images/vmprocess-error.svg';
import vmprocessGraySvg from './images/vmprocess-gray.svg';
import vmprocessSvg from './images/vmprocess.svg';
import instanceWarnSvg from './images/instance-warning.svg';
import instanceErrorSvg from './images/instance-error.svg';
import instanceGraySvg from './images/instance-gray.svg';
import instanceSvg from './images/instance.svg';

// 根据节点类型和状态获取svg图标
export const getNodeImg = (status, nodeType) => {
    switch (nodeType) {
        case 'container':
            switch (+status) {
                case 1:
                    return containerWarnSvg;
                case 2:
                    return containerGraySvg;
                case 3:
                    return containerErrorSvg;
                default:
                    return containerSvg;
            }
        case 'pod':
            switch (+status) {
                case 1:
                    return podWarnSvg;
                case 2:
                    return podGraySvg;
                case 3:
                    return podErrorSvg;
                default:
                    return podSvg;
            }
        case 'node':
        case 'vmhost':
        case 'vm_node':
            switch (+status) {
                case 1:
                    return hostIpWarnSvg;
                case 2:
                    return hostIpGraySvg;
                case 3:
                    return hostIpErrorSvg;
                default:
                    return hostIpSvg;
            }
        case 'workload':
            switch (+status) {
                case 1:
                    return workloadWarnSvg;
                case 2:
                    return workloadGraySvg;
                case 3:
                    return workloadErrorSvg;
                default:
                    return workloadSvg;
            }
        case 'service':
        case 'vmservice':
        case 'vm_service':
            switch (+status) {
                case 1:
                    return serviceWarnSvg;
                case 2:
                    return serviceGraySvg;
                case 3:
                    return serviceErrorSvg;
                default:
                    return serviceSvg;
            }
        case 'namespace':
            switch (+status) {
                case 1:
                    return namespaceWarnSvg;
                case 2:
                    return namespaceGraySvg;
                case 3:
                    return namespaceErrorSvg;
                default:
                    return namespaceSvg;
            }
        case 'vmprocess':
            switch (+status) {
                case 1:
                    return vmprocessWarnSvg;
                case 2:
                    return vmprocessGraySvg;
                case 3:
                    return vmprocessErrorSvg;
                default:
                    return vmprocessSvg;
            }
        case 'vm_instance':
            switch (+status) {
                case 1:
                    return instanceWarnSvg;
                case 2:
                    return instanceGraySvg;
                case 3:
                    return instanceErrorSvg;
                default:
                    return instanceSvg;
            }
    }
};

// 获取节点fill和stroke status：0——正常、1——异常、2——已消亡、3——故障
export const getNodeColor = status => {
    switch (+status) {
        case 1:
            return { fill: 'rgba(203, 140, 48, 0.12)', stroke: '#CB8C30' };
        case 2:
            return { fill: 'rgba(145, 149, 155, 0.12)', stroke: '#D0D9E8' };
        case 3:
            return { fill: '#eff6ff', stroke: '#F7313B' };
        default:
            return { fill: 'rgba(239, 246, 255, 1)', stroke: '#2373ff' };
    }
};

export const typeList = [
    {
        value: 'namespace',
        title: '命名空间',
        type: 'namespace',
    },
    {
        value: 'service',
        title: '服务',
        type: 'service',
    },
    {
        value: 'workload',
        title: '工作负载',
        type: 'workload',
    },
    {
        value: 'node',
        title: '节点',
        type: 'node',
    },
    {
        value: 'pod',
        title: 'Pod',
        type: 'pod',
    },
    {
        value: 'container',
        title: '容器',
        type: 'container',
    },
    {
        value: 'thread',
        title: '进程',
        type: 'thread',
    },
    {
        value: 'vmprocess',
        title: '进程',
        type: 'vmprocess',
    },
    {
        value: 'vmhost',
        title: '主机',
        type: 'vmhost',
    },
    {
        value: 'vmservice',
        title: '应用',
        type: 'vmservice',
    },
    {
        value: 'vm_service',
        title: '应用',
        type: 'vm_service',
    },
    {
        value: 'vm_instance',
        title: '实例',
        type: 'vm_instance',
    },
    {
        value: 'vm_node',
        title: '主机',
        type: 'vm_node',
    },
];
